<template>
  <div class="feng">
    <router-view></router-view>
    <h1 style="color: white">大川药房，欢迎您！</h1>
    <div class="yun">
      <div class="shurukuang1">
        <el-input placeholder="请输入账号" v-model="input1" clearable>
        </el-input>
      </div>
      <div class="shurukuang2">
        <el-input placeholder="请输入密码" v-model="input2" clearable>
        </el-input>
      </div>
    </div>
    <div class="anniu1">
      <el-button type="success" plain @click="dl_fn()">登录</el-button>
    </div>

    <div class="anniu2">
      <el-button type="success" plain @click="zc_fn()">注册</el-button>
    </div>
  </div>
</template>
<script>
export default {
  name: "ONE",
  data() {
    return {
      input1: "",
      input2: "",
      type1: "",
    };
  },
  methods: {
    dl_fn() {
      console.log(111111)
      this.axios({
        method: "post",
        url: "http://localhost:3000/denglu",
        data: {
          input1: this.input1,
          input2: this.input2,
        },
        processData: false,
        contentType: false,
      })
        .then((res) => {
          this.type1 = res.data.data;
          console.log(this.type1);
          if(this.type1.length > 0){
              this.$router.push("/zhuye");
          }else{
              console.log(1111)
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    zc_fn() {
      // console.log(111111)
      this.axios({
        method: "post",
        url: "http://localhost:3000/zhuce",
        data: {
          input1: this.input1,
          input2: this.input2,
        },
      })
        .then((res) => {
          // this.type1 = res.data.data;
          console.log(res);
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
};
</script>
<style scoped>
.feng {
  width: 100%;
  height: 700px;
  text-align: center;
  background-image: url(../assets/药店.png);
  background-size: 100%;
  position: relative;
}
.yun {
  /* border: 1px solid black; */
  position: absolute;
  width: 60%;
  height: 110px;
  top: 50%;
  left: 20%;
}
/* .shurukuang1{
    position: absolute;
    width: 60%;
    height: 30px;
    top: 50%;
    left: 20%;
} */
.shurukuang1,
.shurukuang2 {
  margin-top: 15px;
}
.anniu1 {
  position: absolute;
  height: 30px;
  top: 68%;
  left: 22%;
}
.anniu2 {
  position: absolute;
  height: 30px;
  top: 68%;
  left: 60%;
}
</style>